
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.sql.*"%>
<%@page import="jobportal.Dbconn" %>
<%@include file="header.jsp" %>
<script>
    $(document).ready(function(){
        $("#cmanager").validationEngine();

        $('#from').datepicker({
            dateFormat: 'dd-M-yy',
            inline: true
        });

        $('#to').datepicker({
            dateFormat: 'dd-M-yy',
            inline: true
        });
    });
</script>
<% try {
                Connection con = Dbconn.getConn();
                String jobid = "";
                jobid = request.getParameter("jobid");
                Statement st = con.createStatement();
                String fromdate, todate;
                fromdate = request.getParameter("from");
                todate = request.getParameter("to");

                String querystr = "";
                if (fromdate == null || todate == null || fromdate.equals("") || todate.equals("")) {
                    querystr = "";
                } else {

                    java.util.Date dt = new SimpleDateFormat("dd-MMM-yy").parse(fromdate);
                    SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd");
                    fromdate = s.format(dt);
                    dt = new SimpleDateFormat("dd-MMM-yy").parse(todate);
                    s = new SimpleDateFormat("yyyy-MM-dd");
                    todate = s.format(dt);
                    querystr = "jobpostdate between '" + fromdate + "' and '" + todate + "' and";

                }
                //SELECT jobs.jobid,jobtitle, walkindate,validuntil,count(*) as cnt FROM jobs,job_applied  where jobpostdate between '2012-04-11' and '2012-04-27' and jobs.jobid=job_applied.jobid group by jobid
                String sql = "SELECT jobs.jobid,jobtitle,jobpostdate, walkindate,validuntil,count(*) as cnt FROM jobs,job_applied  where " + querystr + " jobs.jobid=job_applied.jobid and hallticketstatus is null and compid='"+ session.getAttribute("username") + "' and walkindate>now() group by jobs.jobid ";
                //out.println(sql);
                ResultSet rs = st.executeQuery(sql);
%>

<table width="100%" border="0" cellpadding="0" cellspacing="0" >
    <tr>
        <td  align="left" valign="top"><span class="mainheading_emp">Candidate Manager</span></td></tr>
    <tr><td><table width="100%" border="0" cellspacing="0" >
                <tr>
                    <td width="100%" align="left" ></td>
                </tr>
                <tr>
                    <td height="90" align="left" valign="top"><table width="100%" border="0" class="tbl_bdr">

                        </table>
                        <img src="../images/blank.gif" alt="blank" width="18" height="17" border="0" /><br>
                        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tbl_bdr">
                            <tr>
                                <td><table width="100%" border="0">
                                        <tr style="color:#000066;font-weight:bold" align="center">
                                        <td width="32" height="43"  align="center" valign="middle" class="subjeading" style="background-color: skyblue">#</td>
                                            <td valign="middle" class="subjeading" style="background-color: skyblue">Job Title </td>
                                          <td width="134" valign="middle" class="subjeading" style="background-color: skyblue">Posted on </td>
                                          <td width="130" valign="middle" class="subjeading" style="background-color: skyblue">Expiry Date </td>
                                          <td width="121" valign="middle" class="subjeading" style="background-color: skyblue">Status</td>
                                          <td width="184" valign="middle" class="subjeading" style="background-color: skyblue">Action</td>
                                  </tr>
                                        <% int i=0;
										while (rs.next()) { i++;
										%>

                                        <tr class="greybg" style="font-weight:bold" align="center">
                                        <td height="90"  valign="middle" ><%=i%>&nbsp;</td>
                                          <td  valign="middle" class="alink"><a href="candidatemanager.jsp?jobid=<%=rs.getString("jobtitle")%>"><%=rs.getString("jobtitle")%></a><font color="#000000"> (<%=rs.getString("cnt")%>)</font></td>
                                            <td  valign="middle"><a href="view_posted_jobs_emp.jsp?jobid=<%=rs.getString("jobtitle")%>" title="View Job Details"><%= rs.getString("jobpostdate")%></a></td>
                                            <td  valign="middle" ><%= rs.getString("validuntil")%></td>
                                            <td  valign="middle" ><%
                                                    java.util.Date date=new java.util.Date();
                                                    java.util.Date datevalid=rs.getDate("validuntil");
                                                    if(date.compareTo(datevalid)>=0){
                                                        out.println("<font color=\"red\">Expired</font>");
                                                        }else{

                                                            out.println("Active");
                                                        }


%></td>
                                            <td  valign="middle" ><a href="manage_jobseekers.jsp?jobid=<%=rs.getString("jobid")%>" title="Verify HallTicketStatus"><input type="button" value="Verify HallTicket" class="button2" style="width:120px; height:40px;"></a>                </td>
                                        </tr>
                                        <%}%>
                                        <tr align="center">

                <td width="32" height="33"  valign="middle" class="subjeading" style="background-color: skyblue"></td>
                <td width="121"  valign="middle" class="subjeading" style="background-color: skyblue"></td>
                <td width="134"  valign="middle" class="subjeading" style="background-color: skyblue"></td>
				<td width="130"  valign="middle" class="subjeading" style="background-color: skyblue"></td>
                <td width="121"  valign="middle" class="subjeading" style="background-color: skyblue">&nbsp;</td>
                <td width="184"  valign="middle" class="subjeading" style="background-color: skyblue">&nbsp;</td>
                          </tr>

                              </table></td>
                            </tr>
                        </table></td>
                </tr>
            </table></td>
    </tr>
</table>
<%} catch (Exception e) {
                out.println("<font color=\"black\">" + e + "</font>");
            }%>
			<%@include file="footer.jsp"%>
